package com.ming.service.impl;

import com.ming.dao.ProductCategoryRepository;
import com.ming.pojo.ProductCategory;
import com.ming.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;

import java.util.List;

/** 类目
 * Created by LIANG on 2018/3/11.
 */
@Service
@Primary
public class CategoryServiceImpl implements CategoryService {

    @Autowired
    private ProductCategoryRepository productCategoryRespository;

    @Override
    public ProductCategory findOne(Integer categoryId) {
       ProductCategory productCategory = productCategoryRespository.findOne(categoryId);
        return productCategory;
    }

    @Override
    public List<ProductCategory> findAll() {
        return productCategoryRespository.findAll();
    }

    @Override
    public List<ProductCategory> findByCategoryTypeIn(List<Integer> categroyTypeList) {
        return productCategoryRespository.findByCategoryTypeIn(categroyTypeList);
    }

    @Override
    public ProductCategory save(ProductCategory productCategory) {
        return productCategoryRespository.save(productCategory);
    }
}
